#ifndef DBALERTLOG_H
#define DBALERTLOG_H

#pragma once
#include <QString>
#include <QVariant>
#include "model/modelmsg.h"
#include <QDateTime>
#include <QSharedPointer>

namespace ns_yht
{

    class DbAlertLog
    {
    public:
        DbAlertLog();
        ~DbAlertLog();

        bool getList(QVector<QSharedPointer<ModelMsg>> &modelList);
        bool getList(QVector<QSharedPointer<ModelMsg>> &modelList, int type, qint64 beginTime, qint64 endTime);
        bool getList(QVector<QSharedPointer<ModelMsg>> &modelList, int pageIndex, int pageSize);
        bool getUnPostedList(QVector<QSharedPointer<ModelMsg>> &modelList);
        bool updatePosted();
        bool save(ModelMsg *model, bool posted);
        bool deleteOne(int id);
        bool removeBefore(qint64 ctime);

        int getCount();

    private:
        bool checkTable();
        bool tableOk{false};
    };

} // namespace ns_yht
#endif